package by.yakusekmaxim.bookgid.webapp.page.utils.renderer;

import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.model.ResourceModel;

import by.yakusekmaxim.bookgid.datamodel.enums.PublicationStatus;


public class PublicationStatusRenderer implements IChoiceRenderer<PublicationStatus> {

	public static PublicationStatusRenderer INSTANCE = new PublicationStatusRenderer();
	
	@Override
	public Object getDisplayValue(PublicationStatus object) {
		if (object == PublicationStatus.publicationstatus_edited) {
			return new ResourceModel("p.admin.author.status.edited").getObject();
		}

		if (object == PublicationStatus.publicationstatus_published) {
			return new ResourceModel("p.admin.author.status.published").getObject();
		}

		if (object == PublicationStatus.publicationstatus_validation) {
			return new ResourceModel("p.admin.author.status.validation").getObject();
		}
		return null;
	}

	@Override
	public String getIdValue(PublicationStatus object, int index) {
		return object.name();
	}

}
